import request from '@/utils/request.js'

/**
 * 登录
 * @param {Object} { user_name, password }
 * @returns
 */
export const loginAPI = ({ user_name, password }) => {
  return request.post('/auth/login', { user_name, password })
}

/**
 * 手机号验证
 * @param {*} phone
 * @returns
 */
export const getCodeAPI = (phone) => {
  return request.post('/auth/getCode', { phone })
}

/**
 * 手机号登录
 * @param {*} param0
 * @returns
 */
export const loginPhoneAPI = ({ phone, code }) => {
  return request.post('/auth/loginPhone', { phone, code })
}

/**
 * 注册
 * @param {*} data
 * @returns
 */
export const registerAPI = (data) => {
  return request.post('/auth/register', data)
}

/**
 * 获取小程序码
 * @returns
 */
export const getQRCodeAPI = (data) => {
  return request.get('/auth/createQRcode', { params: data })
}

/**
 * 轮询小程序码
 * @param val
 * @returns
 */
export const checkQRCodeAPI = (val) => {
  return request.post('/auth/checkQRCode', { scene: val })
}
